ovl: prevent private clone if bind mount is not allowed
authorMiklos Szeredi <mszeredi@redhat.com>
Mon, 9 Aug 2021 08:19:47 +0000 (10:19 +0200)
committerSalvatore Bonaccorso <carnil@debian.org>
Thu, 23 Sep 2021 20:35:21 +0000 (21:35 +0100)
commit23a890761f3c7c6d3f593a146db3bea6b6927abb
treed30e906d915d3e4260487b8ef95d69c21bfb442c
parent61df5d454e05720250e01fd0feae89a0bc58a003
ovl: prevent private clone if bind mount is not allowed

Origin: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/commit?id=6a002d48a66076524f67098132538bef17e8445e
Bug-Debian-Security: https://security-tracker.debian.org/tracker/CVE-2021-3732

commit 427215d85e8d1476da1a86b8d67aceb485eb3631 upstream.

Add the following checks from __do_loopback() to clone_private_mount() as
well:

 - verify that the mount is in the current namespace

 - verify that there are no locked children

Reported-by: Alois Wohlschlager <alois1@gmx-topmail.de>
Fixes: c771d683a62e ("vfs: introduce clone_private_mount()")
Cc: <stable@vger.kernel.org> # v3.18
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Gbp-Pq: Topic bugfix/all
Gbp-Pq: Name ovl-prevent-private-clone-if-bind-mount-is-not-allow.patch
fs/namespace.c